import pytest
import sys

def get_student_info(student_id):
    students = {
        1001: {"name": "方鸿新", "age": 21, "sex": "男"},
        1002: {"name": "苏文芷", "age": 21, "sex": "女"},
        1003: {"name": "唐晓芙", "age": 17, "sex": "女"},
        1004: {"name": "赵辛媚", "age": 16, "sex": "女"}
    }
    return students.get(student_id, "The student ID does not exist.")

def student_info_func(student_id, expect):
    assert expect == get_student_info(student_id)

class TestGetStudentInfo1():
    @pytest.mark.skip(reason="无条件跳过")
    def test_case_1(self):
        student_info_func(1001, {"name": "方鸿新", "age": 21,"sex":"男"})

    @pytest.mark.skipif(condition = sys.version > '3', reason="Python 版本大于3跳过")
    # 当前使用的Python版本大于3，跳过此测试
    def test_case_2(self):
        student_info_func(1002, {"name": "苏文芷", "age": 21, "sex": "女"})

    def test_case_3(self):
        student_info_func(1007, "The student ID does not exist.")

@pytest.mark.skip
class TestGetStudentInfo2():
    def test_case_4(self):
        student_info_func(1001, {"name": "方鸿新", "age": 21, "sex": "男"})

if __name__ == '__main__':
    pytest.main(["-v", "pytest_skip_test.py"])
    # -v: verbose模式，显示更详细的测试结果
